<template>
	<view class="search">
		<u-navbar :title="title">
			<!-- <view slot="right" class="slot-wrap">
				<text class="iconfont" @tap="getIndex">&#xe609;</text>
			</view> -->
		</u-navbar>
		<view class="list">
			<view class="listX" @tap="englishExamina(0)">
				<view class="listX_right row1">
					<text class="title">{{title}}模拟</text>
				</view>
				<view class="listX_right2">
					<text class="iconfont">&#xe600;</text>
				</view>
			</view>
			<view class="listX" v-if="subject_type == 1 && has_record_chapter == 1" @tap="englishExamina(1)">
				<view class="listX_right row1">
					<text class="title">{{title}}高端(人工阅卷)</text>
				</view>
				<view class="listX_right2">
					<text class="iconfont">&#xe600;</text>
				</view>
			</view>
			<!-- <view v-if="listData.length == 0" style="padding: 20rpx 0;">
				<u-empty  text="没有更多了" mode="list"></u-empty>
			</view> -->
			<!-- <view style="padding: 14rpx 0;">
				<u-loadmore v-if="last_page > 1" :status="status" :icon-type="iconType" :load-text="loadText" />
			</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				subject_type: '',
				has_record_chapter: '',
				course_id: '',
				listData: [],
				refresh: true,
				title: '',
				page: 1,
				last_page: 1,
				status: 'loadmore',
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '没有更多了'
				}
			}
		},
		onLoad(option) {
			console.log(option)
			this.course_id = option.course_id
			this.title = option.title
			this.subject_type = option.subject_type
			this.has_record_chapter = option.has_record_chapter
		},
		onShow() {
			// uni.showLoading({
			// 	title: '加载中'
			// })
			// this.chapterInfo()
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1
			this.refresh = true
			// this.studyListInfo()
		},
		// 上拉加载
		// onReachBottom() {
		// 	if(this.page >= this.last_page) return ;
		// 	this.status = 'loading';
		// 	this.page ++;
		// 	this.refresh = false
		// 	setTimeout(() => {
				
		// 		if(this.page >= this.last_page) this.status = 'nomore';
		// 		else this.status = 'loading';
		// 		this.studyListInfo()
		// 	},500)
		// },
		methods: {
			// 跳转
			englishExamina(id) {
				if (id == 0) {
					uni.navigateTo({
						url: '/pages/home/home/examinationInformation?course_id=' + this.course_id
					})
				} else {
					uni.navigateTo({
						url: '/pages/home/home/buyEnglish?course_id=' + this.course_id
					})
				}
			}
			// 获取章节列表
			// chapterInfo() {
			// 	this.$api.post(global.apiUrls.getSelectChapter, {
			// 		course_id: this.course_id
			// 	}).then(res => {
			// 		console.log(res)
			// 		uni.hideLoading()
			// 		uni.stopPullDownRefresh()
			// 		if (res.data.code == 1) {
			// 			// this.last_page = res.data.data.last_page
			// 			if (this.refresh) {
			// 				this.listData = res.data.data
			// 			} else {
			// 				// this.listData = this.listData.concat(res.data.data.data)
			// 			}
						
			// 		} else {
			// 			this.$message.info(res.data.msg)
			// 		}
			// 	})
			// }
		}
	}
</script>

<style lang="scss" scoped>
	// page {
	// 	background: #FFFFFF;
	// 	height: 100%;
	// 	color: #333333;
	// }
	.search {
		// padding: 24upx 32upx;
		.slot-wrap {
			.iconfont {
				display: inline-block;
				font-size: 36rpx;
				margin-right: 32rpx;
				transform: translateY(-5rpx);
			}
		}
		.empty {
			.img {
				width: 400rpx;
				height: 272rpx;
				margin: 185rpx auto 55rpx;
				image {
					width: 100%;
					height: 100%;
				}
			}
			.noChange {
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: 400;
				line-height: 48rpx;
				color: #999999;
				text-align: center;
			}
			.button {
				width: 360rpx;
				height: 88rpx;
				line-height: 88rpx;
				text-align: center;
				background: #267DFF;
				opacity: 1;
				border-radius: 100rpx;
				margin: 51rpx auto 0;
				color: #FFFFFF;
				font-size: 32rpx;
			}
		}
		.list {
			padding: 0 32rpx;
			.listX {
				width: 100%;
				padding:  32rpx 0;
				display: flex;
				border-bottom: 1rpx solid #EEEEEE;
				
				.listX_right {
					flex: 9;
					width: 90%;
					font-weight: bold;
					.title {
						// height: 90rpx;
						display: inline-block;
						// margin-left: 48rpx;
					}
					.title2 {
						color: #BFBFBF;
					}
				}
				.listX_right2 {
					flex: 1;
					text-align: right;
					// padding-top: 40rpx;
					.iconfont {
						font-size: 12rpx;
					}
				}
			}
		}
		/deep/.u-navbar-inner {
			white-space: nowrap;
		}
	}
</style>
